package lab01;

import java.util.Scanner;

/**
 * Created by 林云志 on 2017/10/8.
 */
public class Test08 {
    public static void main(String[] args) {
        System.out.println("请输入一个1到100的数");
        int number = (int) (Math.random() * 100) + 1;
        Scanner sc = new Scanner(System.in);

        for (int i = 0; ;i++){
            int s = sc.nextInt();
        if (s<number){
            System.out.println("小了");
        }
        else if (s>number){
            System.out.println("大了");
        }
        else {
            System.out.println("猜对了");
            System.out.println("一共用了"+i+"次");
            break;
        }
    }}
}
